package org.fireflow2.designer.eclipse.parts;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.fireflow2.designer.eclipse.modelwrapper.AbsWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.SubProcessWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.ActivityWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.DataFieldWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.EndNodeWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.ResourceDefWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.RouterWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.ServiceDefWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.StartNodeWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.TransitionWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.ActivityListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.DataFieldListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.EndNodeListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.ImportListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.ResourceListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.RouterListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.ServiceListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.StartNodeListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.TransitionListWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.collection.WorkflowElementListWrapper;
import org.fireflow2.designer.eclipse.parts.tree.ActivityListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.ActivityTreePart;
import org.fireflow2.designer.eclipse.parts.tree.DataFieldListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.DataFieldTreePart;
import org.fireflow2.designer.eclipse.parts.tree.EndNodeListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.EndNodeTreePart;
import org.fireflow2.designer.eclipse.parts.tree.ImportListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.ResourceDefListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.ResourceDefTreePart;
import org.fireflow2.designer.eclipse.parts.tree.RouterListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.RouterTreePart;
import org.fireflow2.designer.eclipse.parts.tree.ServiceDefTreePart;
import org.fireflow2.designer.eclipse.parts.tree.ServiceListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.StartNodeListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.StartNodeTreePart;
import org.fireflow2.designer.eclipse.parts.tree.SubflowTreePart;
import org.fireflow2.designer.eclipse.parts.tree.TransitionListTreePart;
import org.fireflow2.designer.eclipse.parts.tree.TransitionTreePart;
import org.fireflow2.designer.eclipse.parts.tree.WorkflowElementListTreePart;

public class TreePartFactory implements EditPartFactory {

	public EditPart createEditPart(EditPart context, Object model) {
		// TODO Auto-generated method stub
		EditPart part = null;
		if (model instanceof SubProcessWrapper){
			part = new SubflowTreePart();

		}
		else if (model instanceof WorkflowElementListWrapper){
			part = new WorkflowElementListTreePart();
		}
		else if (model instanceof ServiceListWrapper){
			part = new ServiceListTreePart();
		}
		else if (model instanceof ServiceDefWrapper){
			part = new ServiceDefTreePart();
		}
		else if (model instanceof ImportListWrapper){
			part = new ImportListTreePart();
		}
		else if (model instanceof ResourceListWrapper){
			part = new ResourceDefListTreePart();
		}
		else if (model instanceof ResourceDefWrapper){
			part = new ResourceDefTreePart();
		}
		else if (model instanceof DataFieldListWrapper){
			part = new DataFieldListTreePart();
		}
		else if (model instanceof DataFieldWrapper){
			part = new DataFieldTreePart();
		}
		
		else if (model instanceof StartNodeWrapper){
			part = new StartNodeTreePart();
		}
		else if (model instanceof StartNodeListWrapper){
			part = new StartNodeListTreePart();
		}

		
		else if (model instanceof ActivityListWrapper){
			part = new ActivityListTreePart();
		}
		else if (model instanceof ActivityWrapper){
			part = new ActivityTreePart();
		}
		else if (model instanceof EndNodeListWrapper){
			part = new EndNodeListTreePart();
		}
		else if (model instanceof EndNodeWrapper){
			part = new EndNodeTreePart();
		}		
		else if (model instanceof RouterListWrapper){
			part = new RouterListTreePart();
		}
		else if (model instanceof RouterWrapper){
			part = new RouterTreePart();
			
		}
		

		else if (model instanceof TransitionListWrapper){
			part = new TransitionListTreePart();
		}
		else if (model instanceof TransitionWrapper){			
				part = new TransitionTreePart();
		}
		

		if (part!=null){
			part.setModel(model);
			if (model instanceof AbsWrapper){
//				((AbsWrapper)model).setEditPart(part);
			}
		}
		return part;
	}

}
